Jump to content

- Appendix B

- # Invision Power Services (IPS) Integration - B.1 - Access/modify the code behind

  Followers 0

  How to make your own modifications or simply just take a look onto the implementation to get an idea of how everything works?

  The following explanations will refer to the VBScript version, the Lua version however is more or less identical in its structure.

  The entire code of this integration is located in one single file, InvisionPowerServices.vbs.

  All functionality is encapsulated in a class (IPS), which defines properties for all parameters (with some validation) as also private and public methods.

  To make use of the IPS class the InvisionPowerServices.vbs file must be included first. This is done in the "Start" block of the GSE Action or your own GSE rule.

      '#inlcude "InvisionPowerServices.vbs"

  Afterwards the class needs to get instantiated, its properties set and the needed public method/function called. The return value of the function is either "0" (ok) or "1" (failed), so it can be used directly for the exits of a "Insert Script Code" or "Run GSE Action" block.

  And this is exactly what the GSE actions of this project are doing.

  In order to make modifications it is not simply possible to modify the InvisionPowerServices.vbs file and re-upload it again into the SwyxWare database. This is because the file is digitally signed, which is necessary to get it included with the #include statement.

  The easiest way to do your own modifications is to forget about the InvisionPowerServices.vbs file all together and use just its content within a start block of a GSE rule (instead of the #include statement), but without the digital signature.

  You can strip the signature yourself from the code (first line and all lines from the bottom), or simply use the content of the start.vbs file from the "vbs" folder or the download package.

      VBScript based\vbs\start.vbs

  So just do all your modifications within the start.vbs file and afterwards just copy & paste the entire content of the file into the "Start" block

  and then use the Insert "Insert Script Code" block to instantiate the IPS class and call its functionality

      Dim c
      Set c = new IPS

      with c
        .sDomain   = "https://www.my-community.com"
        .sAPIKey   = "1234567890"
        .nForum    = 30
        .nAuthor   = 3
        .sTitle    = "My first automated topic"
        .sPost     = "Welcome to the world of REST APIs"
        .nLocked   = 0
        .nHidden   = 0
        .nPinned   = 0
        .nFeatured = 0
        UseExit    = .CreateTopic
      end with

      Set cIPS = Nothing

  It is highly recommended to not do any code modifications directly in the Start block, but instead use a proper editor like VS Code or Notepad++.

  You are now free to to any modifications within the code and use it afterwards in your own GSE rules.

  If you want to update the InvisionPowerServices.vbs in the end, you need to update its signature as well. This can be done with the "SignScript" tool which can be found in the Enreach Partner Net (you need a partner login).

  In order to get get your own .vbs file signed, make sure that the text encoding is UTF-8-BOM. This can easily be checked/configured with Notepad++.

  Please feel free to ask any questions regarding the code, implementation or distribution (signing, including, etc.) in the Open ECR Extensions forum.

  Most of the above mentioned is also true for the following extensions. So there is lots more to explore

  - Jira Service Integration (REST API usage, API Key/Token authentication)
  - Longest Waiting (Database usage)
  - Open Queue (Database usage)
  - Zendesk Integration (REST API usage, Key/Token authentication)

  By Tom Wellige

  - August 28, 2024
  Share
  Share
  Followers 0

## Important Information

By using this site, you agree to our Terms of Use and have taken note of our Privacy Policy.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.